﻿using System;

namespace KingRoad.EPM.PersonnelLogEntity
{
    [AttributeUsage(AttributeTargets.Property)]
    public class ExcelImportValidationAttribute : Attribute
    {
        /// <summary>
        /// 列的名称
        /// </summary>
        public string Name { get; private set; }
        /// <summary>
        /// 列的排序
        /// </summary>
        public int Order { get; private set; }
        /// <summary>
        /// 描述信息
        /// </summary>
        public string Describtion { get; private set; }
        /// <summary>
        /// 异常信息描述
        /// </summary>
        public string ErrorDescribtion { get; private set; }
        /// <summary>
        /// 是否允许为空
        /// </summary>
        private bool _isAllowEmpty = true;
        public bool IsAllowEmpty
        {
            get { return _isAllowEmpty; }
            set { _isAllowEmpty = value; }
        }

        public ExcelImportValidationAttribute(string name, int order, string describtion)
        {
            Name = name;
            Order = order;
            Describtion = describtion;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name">列的中文名称</param>
        /// <param name="order">排序</param>
        /// <param name="isAllowEmpty">是否允许为空</param>
        /// <param name="describtion">必填项描述</param>
        /// <param name="errorDesc">错误信息描述</param>
        public ExcelImportValidationAttribute(string name, int order, bool isAllowEmpty, string describtion, string errorDesc)
        {
            Name = name;
            Order = order;
            IsAllowEmpty = isAllowEmpty;
            Describtion = describtion;
            ErrorDescribtion = errorDesc;
        }
    }
}